#ifndef RP2ALPHASTATE_H
#define RP2ALPHASTATE_H

#include "Rp2GlobalState.h"
#include "Rp2ColorRGBA.h"

namespace Rp2
{

class AlphaState : public GlobalState
{

RP2_DECLARE_INITIALIZE;
RP2_DECLARE_TERMINATE;

public:
	AlphaState();
	virtual ~AlphaState();

	virtual StateType GetStateType() const {return ALPHA;}

	// Source blend types
	enum SrcBlendType
	{
        SBF_ZERO,
        SBF_ONE,
        SBF_DST_COLOR,
        SBF_ONE_MINUS_DST_COLOR,
        SBF_SRC_ALPHA,
        SBF_ONE_MINUS_SRC_ALPHA,
        SBF_DST_ALPHA,
        SBF_ONE_MINUS_DST_ALPHA,
        SBF_SRC_ALPHA_SATURATE,
        SBF_CONSTANT_COLOR,
        SBF_ONE_MINUS_CONSTANT_COLOR,
        SBF_CONSTANT_ALPHA,
        SBF_ONE_MINUS_CONSTANT_ALPHA,
        SBF_QUANTITY
	};
	// Destination blend types
	enum DstBlendType
	{
        DBF_ZERO,
        DBF_ONE,
        DBF_SRC_COLOR,
        DBF_ONE_MINUS_SRC_COLOR,
        DBF_SRC_ALPHA,
        DBF_ONE_MINUS_SRC_ALPHA,
        DBF_DST_ALPHA,
        DBF_ONE_MINUS_DST_ALPHA,
        DBF_CONSTANT_COLOR,
        DBF_ONE_MINUS_CONSTANT_COLOR,
        DBF_CONSTANT_ALPHA,
        DBF_ONE_MINUS_CONSTANT_ALPHA,
        DBF_QUANTITY
	};

	enum TestMode
	{
        TF_NEVER,
        TF_LESS,
        TF_EQUAL,
        TF_LEQUAL,
        TF_GREATER,
        TF_NOTEQUAL,
        TF_GEQUAL,
        TF_ALWAYS,
        TF_QUANTITY
	};
	
	bool BlendEnabled;				//default : false
	SrcBlendType SrcBlend;			//default : SBF_SRC_ALPHA
	DstBlendType DstBlend;			//default : DBF_ONE_MINUS_ALPHA
	bool TestEnabled;				//default : false
	TestMode Test;					//default : TF_ALWAYS
	float Reference;				//default : 0, always in [0,1]
	ColorRGBA ConstantColor;		//default : (0,0,0,0)

};

RP2_REGISTER_INITIALIZE(AlphaState);
RP2_REGISTER_TERMINATE(AlphaState);
typedef Pointer<AlphaState> AlphaStatePtr;

}
#endif